// The information used to read BIN BTP files was got from here
// https://humming-owl.neocities.org/smg-stuff/pages/tutorials/file-formats/btp
#ifndef BTP_HEADER
#define BTP_HEADER

// this header needs
#include <stdio.h> 
#include "../J3DGRAPH.h"
#include "../BMD_BDL/BMD_BDL.h"

// BTP constants
#define J3DGRAPH_MIN_BTP_SIZE 96

// header
char * J3DGRAPH_BTP_START[2] = {"J3D1", "1D3J"};
char * J3DGRAPH_BTP_ID[2] = {"btp1", "1ptb"};
#define J3DGRAPH_BTP_SEC_CNT 1
byte J3DGRAPH_BTP_UNK_1[17] = {0xFF, 0xFF, 0xFF, 0xFF,
                               0xFF, 0xFF, 0xFF, 0xFF,
                               0xFF, 0xFF, 0xFF, 0xFF,
                               0xFF, 0xFF, 0xFF, 0xFF, 0x00};
// BTP UNKNOWN 1 is the same for big/little endian (kinda like padding)
                    
// SECTIONS
char * J3DGRAPH_BTP_SEC_START[1][2] = {{"TPT1", "1TPT"}};
byte J3DGRAPH_BTP_TPT1_UNK_1 = 0xFF;
umax J3DGRAPH_BTP_TPT1_OFFSET = 0x20;
byte J3DGRAPH_BTP_TPT1_UNK_2 = 0x00;
umax J3DGRAPH_BTP_TPT1_UNK_3 = 0xFFFFFF;
umax J3DGRAPH_BTP_TPT1_UNK_4 = 0xFFFF;

// include the different BTP section headers
#include "TPT1.h"

// function to check a BTP
j3dgraph_t check_j3dgraph_btp(char * fpath);

// build/close/print a complete j3dgraph BTP structure
j3dgraph * open_j3dgraph_btp(char * fpath);
void close_j3dgraph_btp(j3dgraph * file);
void print_j3dgraph_btp(j3dgraph * file);

// specific funtions
bool check_j3dgraph_btp_agst_bmd_bdl(char * btp_path, char * bmd_bdl_path);

#include "BTP.c"

#endif // BTP_HEADER
